package com.lastcrdg.testdagger;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.lastcrdg.testdagger.base.MyApp;

import javax.inject.Inject;

/**
 * author：liluo
 * e-mail：lastcrazysun@163.com
 * company：cusc
 * date：2017/8/28 9:41
 * description：
 */

public class SecondActivity extends AppCompatActivity {

    @Inject
    Cloth cloth;
    @Inject
    ClothHandler clothHandler;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView tv = (TextView) findViewById(R.id.tv);
        SecondComponent build = DaggerSecondComponent.builder()
                .baseComponent(((MyApp)getApplication()).getBaseComponent())
                .secondModule(new SecondModule())
                .build();
        build.inject(this);
        tv.setText(clothHandler.handler(cloth) + ",地址：" + clothHandler);
    }

}
